{% if groups.nacos|length >=1 %}
upstream nacos {
    {% for host in groups.nacos %}
        server {{ hostvars[host].ansible_ssh_host }}:{{ nacos.port }};
    {% endfor %}
    }

server {
	    listen {{ nginx.nacos_port }};

        location / {
            proxy_pass http://nacos ; #转发给tomcat组
            proxy_redirect off ;
            proxy_set_header Host $host:{{ nginx.nacos_port }};
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header REMOTE-HOST $remote_addr;
            proxy_set_header X-Forwarded-For $remote_addr;
        }
	}
{% endif %}